package org.example.pinda.exception.code;

import lombok.AllArgsConstructor;
import lombok.Getter;

@Getter
@AllArgsConstructor
public enum ExceptionCode implements EnumText<Integer> {

    // 系统相关
    SUCCESS(200, "成功"),
    SYSTEM_EX(-1, "系统繁忙，请稍后再试"),
    TIMEOUT_EX(-2, "请求超时，请稍后再试"),
    PARAM_EX(-3, "参数类型解析异常"),
    SQL_EX(-4, "执行SQL出现异常"),
    NPE(-5, "空指针异常"),
    ILLEGAL_ARGUMENTS_EX(-6, "无效参数异常"),
    REQUEST_TYPE_EX(-7, "请求类型异常"),
    LOAD_RESOURCE_EX(-8, "加载资源出错"),
    VALID_EX(-9, "统一验证参数异常"),
    OPERATOR_EX(-10, "操作异常"),

    BAD_REQUEST(400, "错误的请求"),
    UNAUTHORIZED(401, "未经授权"),
    NOT_FOUND(404, "没有找到资源"),
    METHOD_NOT_ALLOWED(405, "不支持当前请求类型"),

    TOO_MANY_REQUEST(429, "请求次数超过上限"),
    INTERNAL_SERVER_EX(500, "内部服务错误"),
    GATEWAY_EX(502, "网关错误"),
    GATEWAY_TIMEOUT(504, "网关超时"),

    REQUIRED_FILE_PARAM_EX(1001, "请求中必须至少包含一个有效文件"),

    // Token 相关
    JWT_TOKEN_EXPIRED(40001, "会话超时，请重新登录"),
    JWT_ILLEGAL(40002, "不合法的 token"),
    JWT_ILLEGAL_ARGUMENTS(40003, "缺少token参数"),
    JWT_GEN_TOKEN_FAILED(40004, "生成token失败"),
    JWT_PARSER_TOKEN_FAILED(40005, "token解析失败"),
    JWT_USER_INVALID(40006, "用户名或密码错误"),
    JWT_USER_DISABLE(40007, "用户已被禁用");

    /**
     * 状态码
     */
    private final int value;
    /**
     * 提示信息
     */
    private final String text;

}
